<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>$.ajax方法基本使用</title>
</head>

<body>
    <button id="btn">点我发送请求</button>
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
    <script>
        $('#btn').on('click', function () {
            $.ajax({
                type: 'post',
                url: '/base',
                data: {
                    name: 'zhangsan', age: '20'
                },
                success: function (response) {
                    console.log(response)
                },
                error: function (xhr) {
                    console.log(xhr)
                }
            })
        })
    </script>
</body>

</html>